<template>
	<view class="content">
	<!-- 	<f-navbar title="城市" leftIcon="arrow-left" leftIconColor="#fff" fontColor="#fff" fontSize="34" gradient="linear-gradient(-90deg,#B6359C, #EF0A6A )">
		</f-navbar> -->
		<f-navbar title="城市" fontColor="#fff" fontSize="34" gradient="linear-gradient(-90deg,#B6359C, #EF0A6A )">
			<view class="u-flex" slot="left">
				<van-icon name="arrow-left" color="#fff" size="20"/>
			</view>
		</f-navbar>
		<view class="content_box">
			<van-cell clickable :title="item.region" value="" @click="onchangecity(item)" :key="index" v-for="(item,index) in dataList" />
		</view>
	
	</view>
</template>

<script>
	import fNavbar from '@/uni_modules/f-navbar/components/f-navbar/f-navbar.vue';
	import {getOpenStoreRegion} from '../../../utils/app.js'
	export default {
		components: {
			fNavbar,
	
		},
		data() {
			return {
				imgurl: getApp().globalData.imgurl,
				dataList:[],
	
			}
		},
		onLoad() {
		this.getList()
		},
		methods: {
			// 选择城市
			onchangecity(e){
				console.log(e);
				var pages = getCurrentPages();
				var prevPage = pages[pages.length - 2]; //上一个页面
				console.log(prevPage);
				prevPage.setData({
				     cityobj: e
				   })
				   
				   uni.navigateBack({//返回
				     delta: 1,
					 success() {
					 	prevPage.$vm.getHomeData(true,e.region_code)
						prevPage.$vm.cityobj = e
						uni.setStorageSync('cityinfo',e)
					 }
				   })
			},
			// 获取城市列表
			getList(){
				getOpenStoreRegion({
					
				}).then(res => {
					console.log(res);
					// this.SystemCateList = res.data
					// this.getSystemBanner(this.active)
					// this.getHomeData(true)
					this.dataList = res.data
				
				})
			},
		},
		}
</script>

<style>
	page{
		background: #eee;
	}
</style>